import request from '@/utils/request'

export function getExamListApi(params) {
  return request({
    url: "/admin/exam/list",
    method: "get",
    params,
  });
}

export function examAddApi(params = {}) {
  return request({
    url: "/admin/exam/add",
    method: "post",
    data: params,
  });
}

export function addExamQuestionApi(params = {}) {
  return request({
    url: "/admin/exam/question/add",
    method: "post",
    data: params,
  });
}

export function getExamDetailApi(examId) {
  return request({
    url: "/admin/exam/detail",
    method: "get",
    params: { examId },
  });
}

export function editExamApi(params = {}) {
  return request({
    url: "/admin/exam/edit",
    method: "put",
    data: params,
  });
}

export function delExamQuestionApi(examId, questionId) {
  return request({
    url: "/admin/exam/question/delete",
    method: "delete",
    params: { examId, questionId },
  });
}

export function delExamApi(examId) {
  return request({
    url: "/admin/exam/delete",
    method: "delete",
    params: { examId },
  });
}

export function publishExamApi(examId) {
  return request({
    url: "/admin/exam/publish",
    method: "put",
    params: { examId },
  });
}

export function cancelPublishExamApi(examId) {
  return request({
    url: "/admin/exam/cancelPublish",
    method: "put",
    params: { examId },
  });
}